<template>
	<view :class="[BackGround]" :style="[{'font-weight':Style,'font-family':Font,height:100 + '%',minHeight:height + 'px'}]">
		<cu-custom bgColor="bg-gradual-blue" isBack="true">
			<view slot="backText">返回</view>
			<view slot="content">揩车周期详情</view>
		</cu-custom>
		<view :class="['margin-xs radius shadow shadow-lg bg-white' ,BackGroundBox]" v-if="isShow">
			<form @submit="formSubmit" @reset="formReset">
				<view class="cu-form-group">
					<view class="title">揩车位置</view>
					<input type="text" name="LREPPOSITION" placeholder="请手动输入" />
				</view>
				<view class="cu-form-group">
					<view class="title">揩车方式</view>
					<input type="text" name="LREPTYPPE" placeholder="请手动输入" />
				</view>
				<!-- <view class="cu-form-group">
					<view class="title">油脂类型</view>
					<input type="text" name="LREPPRDTYPE" placeholder="请手动输入" />
				</view> -->
				<view class="cu-form-group">
					<view class="title">供应商</view>
					<input type="text" name="LPTNCODE" placeholder="请手动输入" />
				</view>
				<view class="cu-form-group">
					<view class="title">周期(天)</view>
					<input type="number" name="LREPCIRCLE" placeholder="请输入" />
				</view>
				<button-father :Position="'tb-fa-fixed'">
					<button class="cu-btn bg-gradual-blue lg shadow tb-flex cu-btn-new" form-type="submit">确认</button>
				</button-father>
			</form>
		</view>
	</view>
</template>

<script>
	import ButtonFather from '@/colorui/components/ButtonFather.vue'
	import {
		mapGetters,
		mapMutations
	} from 'vuex'
	export default {
		data() {
			return {
				isShow: true,
				height:this.screenHeight,
				item:{},
			}
		},
		computed: {
			...mapGetters(['Style', 'Font', 'Wipegetitem','BackGround','BackGroundBox'])
		},
		components: {
			ButtonFather
		},
	
		onUnload() {
			this.delitem({})
		},
		onShow() {
			if(Object.keys(this.Wipegetitem).length) {
				for (let var1 in this.Wipegetitem) {
					this.$set(this.item,var1,this.Wipegetitem[var1])
				}
			}
		},
		methods: {
			...mapMutations(['delitem','Wipesetlist']),
			
			// 跳转详情
			jumpdetail(info,page) {
				uni.navigateTo({
					url: `./Wipeadddetail/Wipeadddetail?name=${info}&Page=${page}`
				})
			},
			formSubmit(e) {
				//定义表单规则
				var rule = [{
					name: "LREPPOSITION",
					checkType: "notnull",
					errorMsg: "请输入润滑位置"
				}, {
					name: "LREPTYPPE",
					checkType: "notnull",
					errorMsg: "请输入润滑方式"
				}, {
					name: "LPTNCODE",
					checkType: "notnull",
					errorMsg: "请输入供应商"
				},{
					name: "LREPCIRCLE",
					checkType: "notnull",
					errorMsg: "请输入周期"
				}];
				//进行表单检查
				var formData = e.detail.value;
				var checkRes = this.$graceChecker.check(formData, rule);
				if (!checkRes) {
					uni.showToast({
						title: this.$graceChecker.error,
						icon: "none"
					});
				}else {
					// e.detail.value['LUNIT'] = this.picker1[this.index1].LNAME
					this.Wipesetlist(Object.assign(e.detail.value,this.Wipegetitem))
					uni.navigateBack({
						delta: 1
					})
					uni.showToast({
						title: '添加成功',
						icon: 'success',
						duration: 3000
					});
				}
			}
		}
	}
</script>

<style>
	page {
		background-color: whitesmoke;
	}
</style>
